package design.pattern.factory.simpleFactory;

import design.pattern.factory.simpleFactory.impl.AppleIceCream;
import design.pattern.factory.simpleFactory.impl.BananaIceCream;
import design.pattern.factory.simpleFactory.impl.OrangeIceCream;


/**
 * @program: designPattern
 * @description: 定义一个工厂来生产不同口味的
 * @author: dong.chang
 * @create: 2021-04-22 10:33
 **/
public class IceCreamFactory {

    public static IceCream creatIceCream(String taste) {
        IceCream iceCream = null;

        // 这里我们通过switch来判断，具体制作哪一种口味的冰激凌

        switch (taste) {
            case "Apple":
                iceCream = new AppleIceCream();
                break;

            case "Orange":
                iceCream = new OrangeIceCream();
                break;

            case "Banana":
                iceCream = new BananaIceCream();
                break;
            default:
                break;
        }

        return iceCream;
    }
}
